<template>
  <div id="addGoods">
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item><a href="/home">首页</a></el-breadcrumb-item>
      <el-breadcrumb-item>商品管理</el-breadcrumb-item>
      <el-breadcrumb-item>添加商品</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-alert title="添加商品信息" type="info" center show-icon> </el-alert>

      <el-steps
        :space="200"
        :active="activeIndex"
        finish-status="success"
        align-center
      >
        <el-step title="基本信息"></el-step>
        <el-step title="商品参数"></el-step>
        <el-step title="商品属性"></el-step>
        <el-step title="商品图片"></el-step>
        <el-step title="商品内容"></el-step>
        <el-step title="完成"></el-step>
      </el-steps>

      <el-tabs tab-position="left" style="height: 200px" @tab-click="tabEvent">
        <el-tab-pane label="基本信息">
          <el-form ref="addFormRef" :model="addForm" label-width="80px" rules="addFormRules">
            <el-form-item label="商品名称" prop="goods_name">
              <el-input v-model="addForm.goods_name"></el-input>
            </el-form-item>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="商品参数">商品参数</el-tab-pane>
        <el-tab-pane label="商品属性">商品属性</el-tab-pane>
        <el-tab-pane label="商品图片">商品图片</el-tab-pane>
        <el-tab-pane label="商品内容">商品内容</el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'addGoods',
  data() {
    return {
      // 活跃状态的编辑tab区域
      activeIndex: 0,
      // 添加商品的完整表单
      addForm: {
        goods_name: '',
        goods_at: '',
        goods_price: 0,
        goods_number: 0,
        goods_weight: 0,
        goods_introduce: '',
        pics: [],
        attrs: []
      },
      // 添加商品表单的验证规则
      addFormRules: {
        goods_name: [
          { required: true, message:'商品名称不能为空' , trigger: 'blur'}
        ]
      }
    }
  },
  created() {},
  methods: {
    // 待完善
    tabEvent(obj) {
      this.activeIndex = obj.index * 1
    },
  },
}
</script>

<style lang="less" scoped>
.el-steps {
  margin: 15px 0;
}
</style>
